1. Field of the Invention
The present invention pertains to a technology of rendering in a Computer Graphics (CG) technology. In particular, the present invention pertains to an image generation apparatus and program for more realistically displaying reflected light and a shadow on an object surface caused by light from an optical source.
2. Description of the Related Art
In various simulation machines and game machines that use the CG technology, generating more realistic images in real time is required. In such machines, more naturalistic images are displayed by executing processing (so-called rendering) for generating a 2D image from information upon an object modeled in a three-dimensional space, light (virtual optical source), a camera (virtual camera) and the like.
In order to provide a more realistic image, it is necessary to reflect effects from the optical source to the image. The kinds of optical source include: an optical source having very high intensity such as the sun; an optical source having high intensity and having directivity in a certain direction such as a laser beam and spotlight; an optical source having low intensity, having directivity and being reflected by a mirror surface such as the starlight. The reflection on the object surface that occurs when light from such an optical source is applied to the object can be classified into a diffuse reflection and a specular reflection. The reflected light by the diffuse reflection is light that reflects equally in all directions of the object. The reflected light by the specular reflection is light having the directivity. Specifically, it is light which reflects with directivity in the direction of the angle of reflection that is equal to the angle of incidence. The latter diffuse reflection light includes: diffused light which is represented by direct lighting from the sun such as under the sun of daytime; and surrounding light or ambient light which is represented by the light reflected from a surrounding object. In general, since ambient light is produced from innumerable optical sources, in image processing using a computer, ambient light is processed as a constant term of diffused light.
On the other hand, when light (reflected light etc.) and shadows on an object surface are created, it is necessary to consider the followings:
(1) Color and design of a base on an object surface;
(2) Diffuse reflection on the object surface;
(3) Shadow that is produced when light is blocked;
(4) Specular reflection on object surface; and
(5) Background reflections of the environmental surroundings.
In addition, there are a shadow on side where light is not hit like the other side of object and a shadow (self shadow) cast on oneself by projection etc. of object, as a kind of the shadow of the above-mentioned (3), besides a shadow of oneself who drops to other objects.
As the method of creating the light and shadow in consideration of the element like the above-mentioned, for example, there are following methods:
(A) Method for creating luminance etc. of each pixel on polygon side on the basis of vertex data of polygon (data of color, luminance, and transparency etc. of vertex); and
(B) Method for creating it by pasting texture that reflects shadow etc. beforehand on polygon.
As the method of the above-mentioned (A), for example, there are a gouraud shading method and a phone shading method. The gouraud shading method is a method of obtaining for a luminance of an edge by interpolation of the luminance between vertexes by using the vertex data of the polygon, and then drawing in the region of the polygon by interpolation of the luminance between the edge and the edge. The phone shading method is a method of the interpolation of not the luminance but the normal and drawing in the area of the polygon for the luminance of each pixel. As for the phone shading law of the latter, a huge arithmetic processing is needed. Therefore, the gouraud shading law of the former is generally used in the game machine etc. that processing by the real time is required.
On the other hand, as the method of the above-mentioned (B), about each pixel composing the texture, for example, the method of giving information on the color, the luminance, and the transparency beforehand, replacing the pixel in the part where the texture is pasted with the color, the luminance, and the transparency of the texture, or blending respectively the color, the luminance, and the transparency of the polygon is used. In that case, for example, when the texture of opacity or the translucent is pasted a part of the polygon, the polygon is displayed in the way on a display though had the same outline as the shape of the pasted texture. According to like this, as for the method that combines respects of the multitude and creates all of the convexo-concave, when a tabular object with the complex outline with the convexo-concave is displayed, the method that puts the texture with the outline of the object requested to one polygon is adopted.
Here, a concrete example will be shown and described about the processing of rendering by using a prior art.
FIG. 1A to FIG. 1E are schematic diagrams showing an example of a flow of the rendering processing by using the prior art. In order to facilitate understanding here, as shown in FIG. 1A, the case where a polygon model A (the first object) composed by globe A1 and cube A2 is provided on a polygon model B (the second object) of the 2D shape, and light (parallel light of plane shape in this example) is applied from a virtual optical source located above each model will be described as an example.
Base texture T1 shown in FIG. 1B is a texture that represents the color and the design etc. of the base on the object surface. In the process of rendering, a required portion is cut out from the base texture T1 firstly, and the cut required portion is pasted to the first object A and the second object B shown in FIG. 1A. As shown in FIG. 1C, the color and the design on the surface of object B, and the design etc. of object B that reflects on the surface of object A are created by this processing.
On the other hand, the reflected light and the shadow on the object surface are calculated about the color information of each vertex of the polygon (concentration of three primary colors of red (R), green (G), blue (B)) beforehand on the basis of information on the ray vector and the normal vector, etc. And then, it is set as vertex data of the polygon with other attribute information (vertex coordinates, transparency, texture coordinates, and normal vector, etc.). Furthermore, color information on the polygon side is calculated by using the vertex data of the polygon by the interpolation processing of the segment interpolation etc. by using the gouraud shading method, and then the image information of object A and B shown in FIG. 1D is memorized. In addition, the area of the reflected light might change depending on the direction of the gaze, and the shape of the shadow change by moving the optical source. When the state is created, it is necessary to operate the color information of the polygon of the correspondence by the above-mentioned gouraud shading method etc. in consideration of each position of optical source, the object A, and the object B, and to generate the image information for the lighting effect to the real time, in the process of rendering.
Next, the image information of FIG. 1C and the image information in FIG. 1D are multiplied (it is a synthesis as for color information). As shown in FIG. 1E, image that reflects the reflection of light (diffuse and specular) and shadows on the object A and the object B on the surface is created by this processing. Conventionally, for example, the dynamic image of the object A that moves in the three-dimensional space is displayed by repeat the processing of such rendering by the unit of the frame.
In addition, according to the gouraud shading method, the case where no location of each vertex in the irradiation area when light with a small irradiation area in which the spotlight is applied or only a part of vertex is located is occurred. Therefore, there is a problem that the distribution of realistic light cannot be reproduced. For such the problem, for example, an invention to be able to display the effect by the optical source more realistically by detects the polygon located in the discipline of the light of the diffuse reflection light and the specular reflection light and shadows, generating the polygon that is divided and is subdivided, using the vertex data of the polygon, and processing it by the gouraud shading method etc. is disclosed in Japanese Patent Application Laid Open (Kokai) No. 11-203501.
Moreover, for example, it changes by generally reading a separate texture that has the desired design in every case to change the shape of the design drawn in the texture (outline) like creating the appearance for the moon displayed in the background to wane. However, there is a problem such as needing a mass texture map in this method. For such the problem, for example, an invention that enables the shape of the design to be changed by using the same texture by amending alpha value (for example, by amending alpha value of the correspondence in the part to opacity or transparent) that shows the transparency from which the texture is provided for each pixel is disclosed in Japanese Patent Publication No. 3380674.